package org.hackystat.ui.projectviewer.gwt.client.dynatable;

/**
 * An interface for providing row-level updates of data, intended here to used to update a
 * DynaTableWidget.
 * 
 * @author Pavel Senin, copied from Google sample.
 */
public interface DynaTableDataProvider {

  /**
   * An interface allow a widget to accept or report failure when a row data is issued for update.
   */
  interface RowDataAcceptor {
    /**
     * Accepts the data.
     * 
     * @param startRow The start row num.
     * @param rows The data itself.
     */
    void accept(int startRow, String[][] rows);

    /**
     * Error handling.
     * 
     * @param caught The throwable to handle.
     */
    void failed(Throwable caught);
  }

  /**
   * Actually updates the row data.
   * 
   * @param startRow The start row.
   * @param maxRows The max amounts of rows to fetch.
   * @param acceptor The row data acceptor.
   */
  void updateRowData(int startRow, int maxRows, RowDataAcceptor acceptor);
}
